HEIG-VD
Formations » Bachelor » Formation à plein temps » IT Administration (AIT)

Lab 02 - File system snapshots

Pedagogical objectives

Task 1: Local sync

In this task you will create incremental backups of a home directory by using file synchronization and file system snapshots. To store the backup you will use the backup disk you partitioned in the previous lab.

Put the full commands for each step and the output (shortened if too long) into the lab report.

  1. Choose a home directory, preferably your own, for which to create a backup. A full uncompressed backup should fill the ext4 partition of the backup disk to not more than 50%. If the home directory is too big, choose an appropriate sub-tree. To find out how much space is occupied by a directory tree you can use the command du -sh <directory>. The directory will be called the source directory.

  2. On the backup disk, on the ext4 partition, create a directory called <username>_backup that will contain the backup. Change the owner of this directory from root to the owner of the source directory so that (1) you do not need superuser rights to copy files into it and (2) the user can directly read files back from the directory without needing superuser rights. The directory will be called the backup directory.

  3. Perform an initial copy of the source directory to the backup directory.

    In the backup directory you will create a series of sub-directories for the backups. They contain a timestamp of the backup in their name as follows:

    * aeinstein_backup
        * 2015-09-25-093533
        * 2015-09-25-101142
    

    Here the format for the timestamp is <year>-<month>-<day>-<hour><minute><second>. Note that it is good practice to give the times in UTC to be independent of timezones. To create a timestamp string with that format you can use the date command as follows:

    date --utc +%Y-%m-%d-%H%M%S
    

    To perform the initial copy of the source directory into that directory you can use rsync with the -a and -v options:

        rsync -av <source_directory>/ 2015-09-25-093533
    
    • What do these options do?
    • Specifically, which options are implied by the -a option and what do they do?
    • How can you modify the command to avoid typing the timestamp?
    • How much disk space is used by the backup directory?
  4. Without having modified a file in the source directory do an incremental backup.

    rsync -av --delete --link-dest=../2015-09-25-093533 <source_directory>/ 2015-09-25-101142
    

    Note that the path for the --link-dest option has to be given relative to the destination directory.

    How much disk space is used by the backup directory? By the individual snapshot directories? How do you explain?

  5. Modify a file in the source directory and perform another incremental backup:

    rsync -av --delete --link-dest=../2015-09-25-101142 <source_directory>/ 2015-09-26-101200
    

    Using the stat command examine the inodes of different versions of a file. Do this for a file that has not changed between backups and for a file that has changed. What do you see?

    How much disk space is used by the backup directory?

Task 2: Create a remote virtual machine with a virtual disk for backup

In this task you will create a remote virtual machine on Amazon's cloud and attach a virtual disk to it that will contain the backup data.

  1. Follow the instructions in the guide Get set up for Amazon EC2. You can skip the step Create an IAM User.

    • Create the key pair in the EU (Frankfurt) region.

    • Create the security group in the EU (Frankfurt) region and open SSH access from all IP addresses (0.0.0.0).

  2. Create a virtual machine on AWS by following the guide Getting Started with Amazon EC2 Linux Instances.

    • Be sure to switch the console to the EU (Frankfurt) region.

    • In the step Launch an Amazon EC2 Instance instead of choosing the 64-bit Amazon Linux AMI choose the 64-bit Ubuntu Server 14.04 LTS (HVM) Free tier eligible.

  3. After you have created the virtual machine and verified that you can logon, create an EBS volume with 4 GB capacity as described in the guide.

  4. On your local machine configure an SSH shortcut to the virtual machine. Create the file ~/.ssh/config if does not yet exist and add the following lines to it:

    # AWS virtual machine for AIT lab
    Host awsvm
        Hostname 54.164.194.183
        IdentityFile ~/.ssh/<private_key>.pem
        User ubuntu
    

    Replace the address after Hostname with the public IP of the VM. Replace the filename after IdentityFile with the name of the private key that you downloaded from AWS.

    Test this shortcut by typing ssh awsvm. You should see the command line prompt of the VM.

Task 3: Remote sync

In this task you will use the remote virtual machine as backup destination.

  1. Create a backup directory on the VM as described in Task 1 so that the ubuntu user can read/write.

  2. Perform the initial full backup:

    rsync -av <source_directory>/ awsvm:/path/to/destination/2015-09-25-110300
    
  3. Perform an incremental backup

    rsync -av --delete --link-dest=../2015-09-25-110300 <source_directory> awsvm:/path/to/destination/2015-09-25-110800
    

Lab deliverables

Write your lab report in plain text (.txt) or a word processor format (ODF, Word), or PDF. Plain text is preferred.

Put the report into the shared folder at \\eistore1.einet.ad.eivd.ch\cours\tic\MGF\AIT\Rendus. Organize your submissions in folders like so:

Lab due date

Deliver your results at the latest October 14, 2015, 11:30.